package org.example.lambda;

import org.example.entity.Person;
import org.example.entity.User;

import java.util.function.Function;

/**
 * @author why
 * @date 2022/11/1316:26
 */
public class FunctionLambda {


    public static void main(String[] args) {


        Person person1 = new Person("aaa","bbb",23);
        Person person2 = new Person("bbb","bbb",23);
//        Person person2 = new Person("a","bbb",24);


        Function<Person, User> personUserFunction = (Person p) -> {
            return new User(p.getFirstName(), p.getAge());
        };

        System.out.println(personUserFunction.apply(person1));

    }

    private static User printEqual(Person person1, Function<Person, User> function) {
        return function.apply(person1);
    }

}
